#include<iostream>
#include<string>
#include<vector>
using namespace std;

char toAlph(string str){
    cout << str << endl;
    return stoi(str) + 'a' - 1;
}
string freqAlphabets(string str) {
    int idx(0);
    string res;
    string tmp;
    string n1, n2, n3;
    while (idx < str.size()) {
        if (str.substr(idx).size() >= 3) {
            n1 = str[idx];
            idx++;
            n2 = str[idx];
            idx++;
            n3 = str[idx];

            if (n3 == "#") {
                idx++; // skip #
                tmp = n1 + n2;
                res += toAlph(tmp);
            } else {
                res += toAlph(n1);
                res += toAlph(n2);
            }

        } else if (str.substr(idx).size() == 1) { // str.size is 1 or 2
            n1 = str[idx];
            idx++;
            res += toAlph(n1);

        } else if (str.substr(idx).size() == 2) {
            n1 = str[idx];
            // cout << str.substr(idx) << n1 << endl;
            idx++;
            n2 = str[idx];
            idx++;
            res += toAlph(n1);
            res += toAlph(n2);
        }
    }
}




int main() {
    // string str = "12345678910#11#12#13#14#15#16#17#18#19#20#21#22#23#24#25#26#";
    string str = "13267#";
    // this core dump
    int idx(0);
    string res;
    string tmp;
    string n1, n2, n3;
    while (idx < str.size()) {
        if (str.substr(idx).size() >= 3) {
            n1 = str[idx];
            idx++;
            n2 = str[idx];
            idx++;
            n3 = str[idx];

            if (n3 == "#") {
                idx++; // skip #
                tmp = n1 + n2;

                res += toAlph(tmp);
            } else {
                res += toAlph(n1);
                res += toAlph(n2);
            }

        } else if (str.substr(idx).size() == 1) { // str.size is 1 or 2
            n1 = str[idx];
            idx++;
            res += toAlph(n1);

        } else if (str.substr(idx).size() == 2) {
            n1 = str[idx];
            // cout << str.substr(idx) << n1 << endl;
            idx++;
            n2 = str[idx];
            idx++;
            res += toAlph(n1);
            res += toAlph(n2);
        }
        cout << res << endl;
    }
    cout << res << endl;

}
